package com.zl.rbac.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zl.rbac.entity.Role;
import com.zl.rbac.entity.User;
import com.zl.rbac.entity.UserCondition;
import com.zl.rbac.exception.RbacException;

/**
 *用户业务类
 * @InterfaceName: IUserService
 * @author: suke
 * @since: 2021/1/13 9:16
 */
public interface IUserService  extends  IBaseService<User>{

    /**
     *
     * @Title: 高级查询带分页
     * @param pageIndex: 当前页码
     * @param pageSize: 页容量
     * @param userCondition: 条件对象
     * @return com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.zl.rbac.entity.User>
     * @author: suke
     * @since: 2021/1/13 9:47
     */
    public Page<User> queryUserAndRolesByPage(Integer pageIndex, Integer pageSize, UserCondition userCondition) throws  Exception;

    /**
     *
     * @Title: 添加用户,并分配角色
     * @param user  用户信息
     * @param roleIds 一组角色id
     * @return void
     * @author: suke
     * @since: 2021/1/13 13:48
     */
    public  void save(User user, Integer[] roleIds) throws Exception;


    /**
     *
     * @Title: 修改用户,并重新分配角色
     * @param user  用户信息
     * @param roleIds 一组角色id
     * @return void
     * @author: suke
     * @since: 2021/1/13 13:48
     */
    public  void update(User user, Integer[] roleIds) throws Exception;

    /**
     * 
     * @Title: 根据用户id查询用户信息以及分配的角色
     * @param userid 用户id
     * @return com.zl.rbac.entity.User
     * @author: suke
     * @since: 2021/1/13 14:07
     */
    public  User queryUserAndRolesById(Integer userid)throws Exception;

    /**
     *
     * @Title: 登录
     */
    public void login(String username, String password) throws RbacException, Exception;
}
